<template>
	<view>
		<view class="bgi">
			<image class="image" src="http://fsl-test.dderp.cn:33548/adh-mini/my/sts.png" mode=""></image>
			<view class="vip_date">
				<view class="vip_left">
					<!-- <image src="http://fsl-test.dderp.cn:33548/adh-mini/my/set.png" mode=""></image> -->
					<text>累计拿货 1999.00，再拿200元即可享受2.5折优惠</text>
				</view>
				<!-- <view class="vip_rifht">
					立即续费
				</view> -->
			</view>
		</view>
		<TopNav title='我的' :show="true" :opacity="opacity" :close_show="true" />
		<view class="content">
			<view class="user">
				<view class="set" @click="toPageAddress('set')">
					<image src="http://fsl-test.dderp.cn:33548/adh-mini/my/set2.png" mode=""></image>
				</view>
				<view class="user_info" @click="toPageAddress('用户')">
					<view class="user_img">
						<image :src="avatarUrl?avatarUrl:'http://fsl-test.dderp.cn:33548/adh-mini//my/my_system_avatars.png'" mode=""></image>
					</view>
					<view class="user_text">
						<view class="username">
							{{session.XM}} - {{session.SJ}}
						</view>
						<view class="">
							{{session.YHZ}} | {{session.BRAND_CNNAME}}
						</view>
					</view>
				</view>
				<view class="user_money">
					<view class="coupon" @click="toPageAddress('代金券')">
						<view class="num price">
							10
						</view>
						<view class="text">
							代金券
						</view>
					</view>
					<view class="scoring" @click="toPageAddress('积分')">
						<view class="num price">
							120
						</view>
						<view class="text ">
							积分
						</view>
					</view>
					<view class="balance" @click="toPageAddress('余额')">
						<view class="num price">
							7890.00
						</view>
						<view class="text">
							余额(元)
						</view>
					</view>
				</view>
			</view>
			<view class="order padding">
				<view class="my_order  radius">
					<view class="order_title">
						我的订单
					</view>
					<view class="order_list">
						<view class="order_item" v-for="(item, index) in order_list" :key="index"
							@click="toPageOrder(index)">
							<nut-badge :value="item.num" :right="10">
								<view class="order_sts">
									<image :src="item.url" mode=""></image>
								</view>
								<view class="order_text">
									{{ item.title }}
								</view>
							</nut-badge>
						</view>
					</view>
				</view>
			</view>
			<view class="other padding">
				<view class="my_other radius">
					<view class="other_title">
						其他服务
					</view>
					<view class="other_list">
						<view class="other_item" v-for="(item, index) in other_list" :key="index"
							@click="toPageAddress(item.title)">
							<view class="item_img">
								<image :src="item.url" mode=""></image>
							</view>
							<view class="item_text">
								{{ item.title }}
							</view>
							<view class="item_icon">
								<image src="http://fsl-test.dderp.cn:33548/adh-mini/my/right.png" mode=""></image>
							</view>
						</view>
					</view>
				</view>
			</view>


			<view class="user_link">
				<view class="user_link_title">
					<view class="">
						<image src="http://fsl-test.dderp.cn:33548/adh-mini/my/link.png" mode=""></image>
						<text>最近购买过的</text>
					</view>
				</view>
				<view class="goods_list">
					<view class="goods_item" :key="index" v-for="(item, index) in 10">
						<view class="item_img">
							<image src="http://fsl-test.dderp.cn:33548/adh-mini/cart/pj3.jpg" mode=""></image>
						</view>
						<view class="item_info" :style="index % 2 != 0 ? 'background:#fff;' : ''">
							<view class="info_title">
								<view class="">
									特价
								</view>
								LED花格灯
							</view>
							<view class="info_lat">
								<view class="a">
									一周前购买过
								</view>
								<view class="b">
									已售300
								</view>
							</view>
							<view class="info_price">
								<view class="a">
									<view class="a-a">
										￥<text style="font-size: 36rpx;">169</text>
									</view>
									<view class="a-b">
										￥190
									</view>
								</view>
								<view class="b">
									<image src="http://fsl-test.dderp.cn:33548/adh-mini/my/gwc1.png" mode=""></image>
								</view>
							</view>
						</view>
					</view>
				</view>
			</view>
			
			<!-- <nut-cell :show-icon="true" :isLink="true" @click="switchActionSheet('isVisible')">
			    <span><label>基础用法</label></span>
			    <div v-html="state.val"></div>
			  </nut-cell> -->
		</view>
	</view>
</template>

<script setup>
import TopNav from '../../../common/top_nav/index'
import {
	ref
} from 'vue'
import {
	onPageScroll,
	onShow,
	onLoad
} from '@dcloudio/uni-app'
const show = ref(true)
const opacity = ref(0)
// 我的订单
const order_list = ref([{
	title: '全部',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/qb.png',
	num: 4,
},
{
	title: '待审核',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/daishenghe .png',
	num: 1,
},
{
	title: '待发货',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/dfh.png',
	num: 2,
},
{
	title: '已发货',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/yfh.png',
	num: 1,
},
{
	title: '已取消',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/yqx.png',
	num: 0,
},
])
// 其他服务
const other_list = ref([{
	title: '我的店铺设置',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/dp.png'
},
{
	title: '收货地址管理',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/address.png'
},
{
	title: '收藏',
	url: 'http://fsl-test.dderp.cn:33548/adh-mini/my/sc.png'
},
])
const session = ref('')
const avatarUrl = ref('')
onShow(()=>{
	avatarUrl.value = uni.getStorageSync('avatarUrl')
})
onLoad(()=>{
	session.value = uni.getStorageSync('session')
})
// 前往不同的订单
const toPageOrder = (index) => {
	uni.navigateTo({
		url: `/pages/myOrder/index?index=${index}`
	})
}
// 监听 屏幕滚动
onPageScroll((e) => {
	opacity.value = Number((e.scrollTop / 100).toFixed(1) > 1.1 ? 1 : (e.scrollTop / 100).toFixed(1))
})
// 跳转地址
const toPageAddress = (val) => {
	switch (val) {
		case "我的店铺设置":
			uni.navigateTo({
				url: '/pages/shop/index'
			})
			break;
		case "收货地址管理":
			uni.navigateTo({
				url: '/pages/address/index'
			})
			break;
		case "收藏":
			uni.navigateTo({
				url: '/pages/collect/index'
			})
			break;
		case "代金券":
			uni.navigateTo({
				url: '/pages/coupon/index'
			})
			break;
		case "积分":
			uni.navigateTo({
				url: '/pages/accumulate/index'
			})
			break;
		case "余额":
			uni.navigateTo({
				url: '/pages/balance/index'
			})
			break;
			case "用户":
				uni.navigateTo({
					url: '/pages/tabbar/my/userInfo'
				})
				break;
			case "set":
				
				break;
	}
}
</script>

<style scoped lang="scss">
@import '../../../style/my.scss';
</style>